home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 9
/
FM Towns Free Software Collection 9.iso
/
taropyon
/
install
/
install.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-16
|
7KB
|
278 lines
/*************************************************************************
*
* installer
*
* cording ... TaroPYON
*
*************************************************************************/
#include "ccilib.h"
#include "kbcode.h"
#include "install.h"
#define VERSION "1.01a"
#define EDITION "02" /* for FreeSoftWare collection 9 */
#define EVNO_EXIT (9999)
#ifdef _FC9
# define SCREEN_MODE (0x0303)
#else
# define SCREEN_MODE (0x030A)
#endif
int DrvInst = -1;
int PltNoWhite = 5;
int ColBoxNormal = 0;
int ColBoxInfo = 0;
int ColBoxCaution = 0;
int ColBoxError = 0;
int ColMesh = 0;
int init();
int term();
int install_main();
int set_debug_menu(char *mnu);
#ifdef DEBUG
# define _TOPMENU_NUM (2)
#else
# define _TOPMENU_NUM (1)
#endif
int main(int argc, char **argv)
{
init();
install_main();
term();
return (0);
}
int init()
{
char msg[80], tmp[128];
char *mnu;
char *msgMenu[_TOPMENU_NUM];
char *img;
int winBasCol;
APL_init(SCREEN_MODE,1,1);
LHA_sysInit(NULL); /* LHA.DLLの初期化 */
/*------------------------------------------------------------------*/
disp_desktop();
SCN_wrtPage(1);
tmp[0] = 0;
tmp[1] = 255; /* blue */
tmp[2] = 255; /* red */
tmp[3] = 255; /* green */
SCN_palette(0,PltNoWhite,tmp);
/* ベースウィンドゥ ------------------------------------------------*/
SCN_wrtPage(1);
winBasCol = 0;
/* winBasCol = SCN_tile_newMixCol(winBasCol,MIXCOL_STD1,C_HWHITE,C_WHITE);*/
winBasCol = C_THROUGH;
APL_openBaseWin(winBasCol);
/* トップバー ----------------------------------------------------*/
SCN_wrtPage(1);
strcpy(msg," SYSTEM ");
msgMenu[0] = " INSTALL ";
#if _TOPMENU_NUM > 1
msgMenu[1] = " DEBUG ";
#endif
APL_openTopBarMenu(Fnt16x16,msg,C_HGREEN, _TOPMENU_NUM,Fnt16x12,msgMenu,C_MBLACK);
/* [Oh!FM TOWNS]メニュー ----------------------------------------*/
MNU_datAdd( SysMnu, 0, 'A', Fnt16x16, 0, "about_dlg" , 0, "このプログラムについて");
MNU_datAdd( SysMnu, 0, 'F', Fnt16x16, 0, "dsp_freemem", 0, "フリーメモリ" );
/* [INSTALL]メニュー --------------------------------------------*/
mnu = AplMnu[0];
MNU_datAdd( mnu, 0, 'H', Rom16x16, 0, "inst_help", "message.doc", "説明" );
MNU_datAdd( mnu, 0, 0 , Rom16x16, 0, "" , 0 , NULL );
MNU_mnuAdd( mnu, 0, 'T', Fnt16x16, get_inst_taro_mnu() , "TaroPYON" );
MNU_mnuAdd( mnu, 0, 'G', Fnt16x16, get_inst_gsplaydata_mnu() , "MUSIC data for GSPLAY");
/* [DEBUG]メニュー ------------------------------------------------*/
#ifdef DEBUG
set_debug_menu( AplMnu[1] );
#endif
/* [EXIT]ボタン ----------------------------------------------------*/
APL_setExitEvt("EXIT",EVNO_EXIT,"exit_chk");
/* DTA ライブラリ ------------------------------------------------*/
AplDtaInit();
/* 色番号 --------------------------------------------------------*/
ColBoxNormal = SCN_tile_newMixCol(ColBoxNormal ,MIXCOL_NORMAL,C_DARK ,C_WHITE);
ColBoxInfo = SCN_tile_newMixCol(ColBoxInfo ,MIXCOL_NORMAL,C_HGREEN ,C_WHITE);
ColBoxError = SCN_tile_newMixCol(ColBoxError ,MIXCOL_NORMAL,C_HRED ,C_WHITE);
ColBoxCaution = SCN_tile_newMixCol(ColBoxCaution,MIXCOL_NORMAL,C_HYELLOW,C_WHITE);
ColMesh = SCN_tile_newMixCol(ColMesh ,MIXCOL_NORMAL,C_THROUGH,C_WHITE);
return (NORMAL);
}
int term()
{
char tmp[256];
FS_chdrv(toupper(DirStart[0]) - 'A');
sprintf(tmp,"%s.",DirStart);
FS_chdir(tmp);
APL_term();
}
int disp_desktop()
{
#ifdef _FC9
/* for FreeSoftWare collection 9 */
char tmp[256];
sprintf(tmp,"%s%s", DirStart, "install.tif" );
return tif_load(tmp);
return (0);
#else
/* for APPRE CD vol.1 */
#define DESKTOP_TIFNUM (8)
int n;
char tmp[256];
static char lastno = -1;
static char *tbl[DESKTOP_TIFNUM] =
{
"towns04.tif",
"towns05.tif",
"towns06.tif",
"towns07.tif",
"towns08.tif",
"towns09.tif",
"towns10.tif",
"towns11.tif"
};
if ( lastno < 0 )
{
n = 7;
} else
{
srand( clock() & 0x7FFFFFFF );
do
{
n = rand() % DESKTOP_TIFNUM;
} while ( n == lastno );
}
sprintf(tmp,"%s../HYOUSHI/%s", DirStart, tbl[n] );
lastno = n;
return tif_load(tmp);
#endif
}
int install_main()
{
int ret;
SCN_wrtPage(1);
syl_clear();
for (;;)
{
MOS_CON();
ret = EV_chk(EvTop,0);
if ( ret == EVNO_EXIT )
break;
}
return (0);
}
int exit_chk()
{
char *dlgTxm;
int i, ret;
static char *msgtbl[4] =
{
"",
"インストーラを終了しますか?",
"",
NULL
};
dlgTxm = DlgTxm_open(ColBoxCaution);
for ( i = 0; msgtbl[i] != NULL; ++i )
DlgTxm_putf( dlgTxm, Fnt16x16, TXMDAT_ATT_CENTER, msgtbl[i]);
DlgTxm_setBtn( dlgTxm, Fnt16x16, 128, 20, C_MBLACK, C_WHITE, C_HWHITE, C_DARK,
'\r' , KA_EXEC , EVNO_EXIT, "", 0, "終了 : [実行]");
DlgTxm_setBtn( dlgTxm, Fnt16x16, 128, 20, C_MBLACK, C_WHITE, C_HWHITE, C_DARK,
'\x1B', KA_CANCEL, 0, "", 0, "取消 : [取消]");
DlgTxm_setSize(dlgTxm,480,64);
DlgTxm_setPosition(dlgTxm,DLGPOS_CENTER_OF_SCREEN);
ret = DlgTxm_start(dlgTxm);
DlgTxm_close(dlgTxm);
if ( ret != EVNO_EXIT )
ret = 0;
return (ret);
}
int about_dlg()
{
char *dlgTxm;
dlgTxm = DlgTxm_open(ColBoxNormal);
DlgTxm_setTitle(dlgTxm,Fnt16x16, "Installer ver.%s edition #%s",
VERSION, EDITION );
DlgTxm_putf( dlgTxm, Fnt16x16, TXMDAT_ATT_CENTER,"TaroPYON SoftWare Collection インストールプログラム");
DlgTxm_putf( dlgTxm, Fnt16x08, TXMDAT_ATT_CENTER, "");
DlgTxm_putf( dlgTxm, Fnt16x12, TXMDAT_ATT_CENTER,"for FreeSoftWare colletion 9");
DlgTxm_putf( dlgTxm, Fnt16x12, TXMDAT_ATT_CENTER, "");
DlgTxm_putf( dlgTxm, Fnt16x16, TXMDAT_ATT_CENTER, "%c%c TaroPYON",
Gaiji_copyright>>8, Gaiji_copyright&0xFF );
DlgTxm_setBtn( dlgTxm, Fnt16x16, 128, 20, C_MBLACK,
C_WHITE, C_HILIGHT, C_DARK, '\r', KA_EXEC, 0, "", 0, "OK : [実行]");
DlgTxm_setSize(dlgTxm,320,48);
DlgTxm_setPosition(dlgTxm,DLGPOS_CENTER_OF_SCREEN);
DlgTxm_start(dlgTxm);
DlgTxm_close(dlgTxm);
return (0);
}
int dsp_freemem()
{
unsigned int siz;
char *dlgTxm;
char tmp1[32], tmp2[32];
siz = APL_getFreeMem();
dlgTxm = DlgTxm_open(ColBoxInfo);
DlgTxm_setTitle(dlgTxm,Fnt16x16, "FREE MEMORY SIZE");
DlgTxm_putf( dlgTxm, Fnt16x12, TXMDAT_ATT_CENTER,
"free memory %s (%s) bytes",
fdl_ltoaDig(siz,tmp1), fdl_ltoaMsg(siz,tmp2) );
DlgTxm_setBtn( dlgTxm, Fnt16x16, 128, 20, C_MBLACK,
C_WHITE, C_HILIGHT, C_DARK, '\r', KA_EXEC, 0, "", 0, "OK : [実行]");
DlgTxm_setSize(dlgTxm,400,64);
DlgTxm_setPosition(dlgTxm,DLGPOS_NORMAL,2,22);
DlgTxm_start(dlgTxm);
DlgTxm_close(dlgTxm);
}
#include "insttaro.c"
#include "instkok2.c"
#include "instexec.c"
#include "instlib.c"
#include "item.c"
#ifdef DEBUG
# include "debug.c"
#endif